#include "T9manager.h"

int main(int argc, char *argv[]){
	
	Data data;

	initData(&data);

	readConfigFile("/usr/local/numpad/config",&data);
	strcpy(data.dictionary,data.dictionaryEng);	
	data.listat9eng=initDictionary(data.dictionary,data.listat9eng);	
	strcpy(data.dictionary,data.dictionaryIta);
	data.listat9ita=initDictionary(data.dictionary,data.listat9ita);
	strcpy(data.dictionary,data.dictionaryIta);
	data.listat9=data.listat9ita;	
	data.currentnode=data.listat9;
   	GError *error = NULL;
    	gtk_init( &argc, &argv ); 
    	data.builder = gtk_builder_new();
   	if(!gtk_builder_add_from_file(data.builder,data.gui, &error))
    	{
        	g_warning("%s", error->message);
        	g_free(error);
		return(1);
    	}
   
    	data.the_window1 = GTK_WIDGET(gtk_builder_get_object(data.builder, "window1"));
	gtk_window_set_position(GTK_WINDOW(data.the_window1),GTK_WIN_POS_NONE); 
	gtk_window_set_keep_above(GTK_WINDOW(data.the_window1),true); 
	GtkWidget *ita = GTK_WIDGET(gtk_builder_get_object(data.builder, "togglebuttonIta"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ita),TRUE); 		
	data.textarea = GTK_WIDGET(gtk_builder_get_object(data.builder, "entry1")); 
	data.trayIcon  = gtk_status_icon_new_from_file (data.icon);
	gtk_status_icon_set_visible(data.trayIcon, FALSE); 
	gtk_status_icon_set_tooltip (data.trayIcon, "Click to maximize your NumPad");
	add_all_events(&data);	
   	gtk_widget_show(data.the_window1);
	gtk_main();
	g_object_unref(G_OBJECT(data.builder));
	return(0);
}
